From 854d0618e81495ace720ad68f34fc2701cf32638 Mon Sep 17 00:00:00 2001 From: Keir Fraser Date: Wed, 30 Dec 2009 12:40:44 +0000 Subject: [PATCH] libxl: change semantics of ctx_free and remove ctx_close ctx_close isn't use anywhere, and free reallocate the GC array, which is quite surprising and lead to memory leaking in xl.c Signed-off-by: Vincent Hanquez --- tools/libxl/libxl.c | 10 ---------- tools/libxl/libxl.h | 1 - 2 files changed, 11 deletions(-) diff --git a/tools/libxl/libxl.c b/tools/libxl/libxl.c index 043a827551..ecc3bc2753 100644 --- a/tools/libxl/libxl.c +++ b/tools/libxl/libxl.c @@ -53,16 +53,6 @@ int libxl_ctx_free(struct libxl_ctx *ctx) { libxl_free_all(ctx); free(ctx->alloc_ptrs); - ctx->alloc_ptrs = calloc(ctx->alloc_maxsize, sizeof(void *)); - if (!ctx->alloc_ptrs) - return ERROR_NOMEM; - return 0; -} - -int libxl_ctx_close(struct libxl_ctx *ctx) -{ - libxl_ctx_free(ctx); - free(ctx->alloc_ptrs); xc_interface_close(ctx->xch); xs_daemon_close(ctx->xsh); return 0; diff --git a/tools/libxl/libxl.h b/tools/libxl/libxl.h index 3e0e281285..cc6ecee4d6 100644 --- a/tools/libxl/libxl.h +++ b/tools/libxl/libxl.h @@ -253,7 +253,6 @@ void xl_log(struct libxl_ctx *ctx, int errnoval, int loglevel, const char *file, /* context functions */ int libxl_ctx_init(struct libxl_ctx *ctx); int libxl_ctx_free(struct libxl_ctx *ctx); -int libxl_ctx_close(struct libxl_ctx *ctx); int libxl_ctx_set_log(struct libxl_ctx *ctx, libxl_log_callback log_callback, void *log_data); /* domain related functions */ -- 2.30.2